﻿Public Class frmLogistica
  Dim _intFactId As Integer? = Nothing
  Dim _intEntId As Integer? = Nothing
  Private Sub UcLogistica1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles UcLogistica1.Load
    If _intFactId.HasValue Then
      UcLogistica1.LoadLogisticaFromFactura(_intFactId)
    ElseIf _intEntId.HasValue Then
      UcLogistica1.LoadLogisticaFromEntrega(_intEntId)
    End If
  End Sub

  Private Sub UcLogistica1_onCancel() Handles UcLogistica1.onCancel
    Me.Close()
  End Sub

  Private Sub UcLogistica1_onSaved(ByVal pEntregaId As Integer) Handles UcLogistica1.onSaved
    Me.Close()
  End Sub

  ''' <summary>
  ''' Recibe un Id que puede ser de Entrega o de Factura, que va a ser determinado por el parametro pEsEntrega
  ''' </summary>
  ''' <param name="pId">Id de Entrega o de Factura</param>
  ''' <param name="pEsEntrega">Verdadero si es una entrega y falso si es una factura.</param>
  ''' <remarks></remarks>
  Public Sub New(pId As Integer, pEsEntrega As Boolean)

    ' Llamada necesaria para el diseñador.
    InitializeComponent()

    If pEsEntrega Then
      _intEntId = pId
    Else
      _intFactId = pId
    End If
  End Sub
End Class